#import "ASPCalendarException.h"

@implementation ASPCalendarException

/**
 * Maps json key to property name.
 * This method is used by `JSONModel`.
 */
+ (JSONKeyMapper *)keyMapper
{
  return [[JSONKeyMapper alloc] initWithDictionary:@{ @"EnteredByOccurrences": @"enteredByOccurrences", @"FromDate": @"fromDate", @"ToDate": @"toDate", @"Occurrences": @"occurrences", @"Name": @"name", @"Type": @"type", @"Period": @"period", @"MonthItem": @"monthItem", @"MonthPosition": @"monthPosition", @"Month": @"month", @"MonthDay": @"monthDay", @"DayWorking": @"dayWorking", @"WorkingTimes": @"workingTimes", @"DaysOfWeek": @"daysOfWeek" }];
}

/**
 * Indicates whether the property with the given name is optional.
 * If `propertyName` is optional, then return `YES`, otherwise return `NO`.
 * This method is used by `JSONModel`.
 */
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
  NSArray *optionalProperties = @[@"enteredByOccurrences", @"fromDate", @"toDate", @"occurrences", @"name", @"type", @"period", @"monthItem", @"monthPosition", @"month", @"monthDay", @"dayWorking", @"workingTimes", @"daysOfWeek"];

  if ([optionalProperties containsObject:propertyName]) {
    return YES;
  }
  else {
    return NO;
  }
}

/**
 * Gets the string presentation of the object.
 * This method will be called when logging model object using `NSLog`.
 */
- (NSString *)description {
    return [[self toDictionary] description];
}

@end
